package monopoly;


public class StreetProperty extends Property {

	private double rent0House, rent1House, rent2House, rent3House, rent4House, rentHotel;
	private double mortgageValue;
	private int houseCount;
	private double housePrice;
	private int group, position;
	
	
	public StreetProperty()
	{
		super();
		housePrice = 0.0;
		rent0House = 0.0;
		rent1House = 0.0;
		rent2House = 0.0;
		rent3House = 0.0;
		rent4House = 0.0;
		rentHotel = 0.0;
		mortgageValue = 0.0;
		houseCount = 0;
		group = 0;
		position = 0;
	}
	
	public StreetProperty(double price, double housePrice, double rent0House, double rent1House, double rent2House, 
							double rent3House, double rent4House, double rentHotel, double mortgageValue,
							int group, int position, String imageIconFile, String description)
	{
		super(price, imageIconFile, description);
		this.housePrice = housePrice;
		this.rent0House = rent0House;
		this.rent1House = rent1House;
		this.rent2House = rent2House;
		this.rent3House = rent3House;
		this.rent4House = rent4House;
		this.rentHotel = rentHotel;
		this.houseCount = 0;
		this.mortgageValue = mortgageValue;
		this.group = group;
		this.position = position;
	}

	public double getRent(GameState gameState, int rentMultiplier)
	{
		double rent;
		Player owner = super.getOwner();
		if (rentMultiplier != 0)
			System.out.println(rentMultiplier);
		if ((owner.isMonopoly(group)) && (houseCount == 0))
			rent = (rent0House * 2);
		else
		{
			switch (houseCount)
			{
			case 0:	rent = rent0House; break;
			case 1:	rent = rent1House; break;
			case 2:	rent = rent2House; break;
			case 3:	rent = rent3House; break;
			case 4:	rent = rent4House; break;
			case 5:	rent = rentHotel; break;
			default: rent = 0.0; break;
			}
		}
		
		if (rentMultiplier != 0) rent *= rentMultiplier;
		return rent;
	}
	
	
	public void purchase(Player player)
	{
			player.adjustBalance(0-super.getPrice());
			super.setOwner(player);
			player.buyStreetProperty(this, this.group, this.position);
	}
	
	public int getGroup()
	{
		return this.group;
	}
	public int getPosition()
	{
		return this.position;
	}
	
	public double getMortgageValue()
	{
		return this.mortgageValue;
	}
	
	public double getHousePrice()
	{
		return this.housePrice;
	}
	
	public int getHouseCount()
	{
		return this.houseCount;
	}

}
